import cloudbase from '@cloudbase/js-sdk';

// 云开发环境配置
export const cloudbaseConfig = {
  env: process.env.CLOUDBASE_ENV_ID || '', // 环境ID，在腾讯云开发控制台获取
};

// 初始化云开发
export const app = cloudbase.init({
  env: cloudbaseConfig.env,
});

// 获取云开发认证对象
export const auth = app.auth({
  persistence: 'local', // 用户信息持久化
});

// 获取数据库实例
export const db = app.database();

// 云函数命名空间
export const cloudFunctions = {
  getArtworks: 'getArtworks',
  getArtistProfile: 'getArtistProfile',
  uploadArtwork: 'uploadArtwork',
};

// 数据库集合名称
export const collections = {
  artworks: 'artworks',
  artists: 'artists',
  galleries: 'galleries',
};

// 静态资源配置
export const assets = {
  defaultAvatar: '/images/default-avatar.png',
  defaultCover: '/images/default-cover.jpg',
};

// 路由配置
export const routes = {
  home: '/',
  gallery: '/gallery',
  profile: '/profile',
  studio: '/studio',
};

// API接口配置
export const api = {
  baseUrl: process.env.API_BASE_URL || '',
  timeout: 10000,
};

// 应用配置
export const appConfig = {
  name: 'Art Gallery',
  description: '艺术作品展示平台',
  version: '1.0.0',
};

// 环境判断
export const isDev = process.env.NODE_ENV === 'development';
export const isProd = process.env.NODE_ENV === 'production';

// 图片上传配置
export const uploadConfig = {
  maxSize: 5 * 1024 * 1024, // 5MB
  acceptedTypes: ['image/jpeg', 'image/png', 'image/gif'],
  cloudPath: 'artworks/',
};

// 分页配置
export const paginationConfig = {
  defaultPageSize: 12,
  pageSizeOptions: ['12', '24', '36', '48'],
};